package com.jsyh.maidu.presenter;

import android.content.Context;

import com.jsyh.maidu.config.ConfigValue;
import com.jsyh.maidu.http.BaseDelegate;
import com.jsyh.maidu.http.ExceptionHelper;
import com.jsyh.maidu.http.OkHttpClientManager;
import com.jsyh.maidu.model.StoreClassModel;
import com.jsyh.maidu.utils.Utils;
import com.jsyh.maidu.views.StoreClassView;
import com.squareup.okhttp.Request;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by admin on 2017/7/17.
 */

public class StoreClassPresenter extends BasePresenter {
    StoreClassView storeclassview;
    Context context;
    public StoreClassPresenter(StoreClassView storeclassview,Context context)
    {
        this.context=context;
        this.storeclassview=storeclassview;

    }

    public void loadStoreClass(String suppid)
    {
        Map<String ,String> params=new HashMap<>();
        params.put("suppid",suppid);
        OkHttpClientManager.postAsyn(context, ConfigValue.APP_IP + "stores/get_supp_goodscate", params, new BaseDelegate.ResultCallback<StoreClassModel>() {
            @Override
            public void onError(Request request, Object tag, Exception e) {
                Utils.showToast(context, ExceptionHelper.getMessage(e, context));
            }

            @Override
            public void onResponse(StoreClassModel response, Object tag) {
                storeclassview.returnStoreClss(response);
            }


        });

    }
}
